#Boa:Frame:Frame1

import wx
import wx.grid
import utiles
import consultasBD

def create(parent):
    return Frame1(parent)

[wxID_FRAME1, wxID_FRAME1BUTTON1, wxID_FRAME1BUTTON2, wxID_FRAME1BUTTON3, 
 wxID_FRAME1BUTTON4, wxID_FRAME1GRID1, wxID_FRAME1PANEL1, 
 wxID_FRAME1STATICTEXT1, wxID_FRAME1STATICTEXT2, wxID_FRAME1STATICTEXT3, 
 wxID_FRAME1STATICTEXT4, wxID_FRAME1STATICTEXT5, wxID_FRAME1STATICTEXT6, 
 wxID_FRAME1STATICTEXT7, wxID_FRAME1TEXTCTRL1, wxID_FRAME1TEXTCTRL2, 
 wxID_FRAME1TEXTCTRL3, wxID_FRAME1TEXTCTRL4, wxID_FRAME1TEXTCTRL5, 
 wxID_FRAME1TEXTCTRL6, wxID_FRAME1TEXTCTRL7, wxID_FRAME1TEXTCTRL8, 
 wxID_FRAME1TEXTCTRL9, 
] = [wx.NewId() for _init_ctrls in range(23)]

class Frame1(wx.Frame):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
              pos=wx.Point(22, 9), size=wx.Size(758, 603),
              style=wx.DEFAULT_FRAME_STYLE, title='Buscar Articulos')
        self.SetClientSize(wx.Size(750, 576))

        self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1, name='panel1', parent=self,
              pos=wx.Point(0, 0), size=wx.Size(750, 576),
              style=wx.TAB_TRAVERSAL)

        self.staticText1 = wx.StaticText(id=wxID_FRAME1STATICTEXT1,
              label='P.T.C.', name='staticText1', parent=self.panel1,
              pos=wx.Point(16, 8), size=wx.Size(31, 13), style=0)

        self.staticText2 = wx.StaticText(id=wxID_FRAME1STATICTEXT2,
              label='Cod. Sussan', name='staticText2', parent=self.panel1,
              pos=wx.Point(208, 8), size=wx.Size(60, 13), style=0)

        self.textCtrl1 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL1, name='textCtrl1',
              parent=self.panel1, pos=wx.Point(80, 8), size=wx.Size(100, 21),
              style=0, value='')

        self.textCtrl2 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL2, name='textCtrl2',
              parent=self.panel1, pos=wx.Point(272, 8), size=wx.Size(100, 21),
              style=0, value='')

        self.staticText3 = wx.StaticText(id=wxID_FRAME1STATICTEXT3,
              label='Descripcion', name='staticText3', parent=self.panel1,
              pos=wx.Point(16, 40), size=wx.Size(54, 13), style=0)

        self.staticText4 = wx.StaticText(id=wxID_FRAME1STATICTEXT4,
              label='Proveedor', name='staticText4', parent=self.panel1,
              pos=wx.Point(16, 64), size=wx.Size(50, 13), style=0)

        self.textCtrl3 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL3, name='textCtrl3',
              parent=self.panel1, pos=wx.Point(80, 40), size=wx.Size(288, 21),
              style=0, value='')
        self.textCtrl3.Enable(True)
        self.textCtrl3.SetEditable(False)

        self.textCtrl4 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL4, name='textCtrl4',
              parent=self.panel1, pos=wx.Point(80, 64), size=wx.Size(288, 21),
              style=0, value='')
        self.textCtrl4.Enable(True)
        self.textCtrl4.SetEditable(False)

        self.textCtrl5 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL5, name='textCtrl5',
              parent=self.panel1, pos=wx.Point(368, 64), size=wx.Size(96, 21),
              style=0, value='')
        self.textCtrl5.Enable(True)
        self.textCtrl5.SetEditable(False)

        self.button1 = wx.Button(id=wxID_FRAME1BUTTON1, label='Aceptar',
              name='button1', parent=self.panel1, pos=wx.Point(384, 8),
              size=wx.Size(75, 23), style=0)
        self.button1.Bind(wx.EVT_BUTTON, self.OnBotonAceptar,
              id=wxID_FRAME1BUTTON1)

        self.button3 = wx.Button(id=wxID_FRAME1BUTTON3, label='Limpiar',
              name='button3', parent=self.panel1, pos=wx.Point(472, 8),
              size=wx.Size(75, 23), style=0)
        self.button3.Bind(wx.EVT_BUTTON, self.OnBotonLimpiar,
              id=wxID_FRAME1BUTTON3)

        self.button4 = wx.Button(id=wxID_FRAME1BUTTON4, label='Imprimir',
              name='button4', parent=self.panel1, pos=wx.Point(560, 8),
              size=wx.Size(75, 23), style=0)
        self.button4.Bind(wx.EVT_BUTTON, self.OnBotonImprimir,
              id=wxID_FRAME1BUTTON4)

        self.button2 = wx.Button(id=wxID_FRAME1BUTTON2, label='Salir',
              name='button2', parent=self.panel1, pos=wx.Point(656, 8),
              size=wx.Size(75, 23), style=0)
        self.button2.Bind(wx.EVT_BUTTON, self.OnBotonSalir,
              id=wxID_FRAME1BUTTON2)

        self.grid1 = wx.grid.Grid(id=wxID_FRAME1GRID1, name='grid1',
              parent=self.panel1, pos=wx.Point(16, 96), size=wx.Size(720, 472),
              style=0)
        self.grid1.Enable(True)
        self.grid1.EnableEditing(False)

        self.staticText5 = wx.StaticText(id=wxID_FRAME1STATICTEXT5,
              label='Estacion', name='staticText5', parent=self.panel1,
              pos=wx.Point(472, 48), size=wx.Size(40, 13), style=0)

        self.staticText6 = wx.StaticText(id=wxID_FRAME1STATICTEXT6,
              label='Anio', name='staticText6', parent=self.panel1,
              pos=wx.Point(544, 48), size=wx.Size(21, 13), style=0)

        self.staticText7 = wx.StaticText(id=wxID_FRAME1STATICTEXT7,
              label='Grupo', name='staticText7', parent=self.panel1,
              pos=wx.Point(600, 48), size=wx.Size(29, 13), style=0)

        self.textCtrl6 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL6, name='textCtrl6',
              parent=self.panel1, pos=wx.Point(472, 64), size=wx.Size(72, 21),
              style=0, value='')
        self.textCtrl6.SetEditable(False)

        self.textCtrl7 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL7, name='textCtrl7',
              parent=self.panel1, pos=wx.Point(544, 64), size=wx.Size(48, 21),
              style=0, value='')
        self.textCtrl7.SetEditable(False)

        self.textCtrl8 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL8, name='textCtrl8',
              parent=self.panel1, pos=wx.Point(600, 64), size=wx.Size(128, 21),
              style=0, value='')
        self.textCtrl8.SetEditable(False)

        self.textCtrl9 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL9, name='textCtrl9',
              parent=self.panel1, pos=wx.Point(368, 40), size=wx.Size(96, 21),
              style=0, value='')
        self.textCtrl9.SetEditable(False)

    def __init__(self, parent):
        self._init_ctrls(parent)
        self.crearGrilla()

    def crearGrilla(self):
        columnas = ['PTC','Codigo\nSussan','Talle','Color','Grupo','Precio\nventa','Stock\nCentral','Stock\nParana','Stock\nSaska','Stock\nPeatonal']
        self.nroColumnas = len(columnas)
        self.grid1.CreateGrid(1, self.nroColumnas)
        for col in xrange(self.nroColumnas):
            self.grid1.SetColLabelValue(col,columnas[col])
        for col in xrange(self.nroColumnas):
            self.grid1.AutoSizeColumn(col,True)
        self.grid1.SetSelectionMode(wx.grid.Grid.wxGridSelectRows)

    def OnBotonSalir(self, event):
        self.Close()

    def consultaSQL(self):
        #consulta por PTC
        if str(self.textCtrl1.GetValue()) != "":
            r1 = "SELECT ptc,codsussan,talle,color,colores.nombre,descripcion,codprov,proveedor,grupo,nombregrupo,precioventa,estacion,anio,temporada \n"
            r2 = "FROM colores, \n"
            r3 = "  (SELECT ptc,codsussan,talle,color,descripcion,codprov,nombre as proveedor,preciolt1 as precioventa,grupo,nombregrupo,estacion,anio,temporada \n"
            r4 = "   FROM proveedor, \n"
            r5 = "        (SELECT id as ptc, codsussan, talle, color, descri as descripcion, proveedor as codprov, preciolt1, paso2.grupo, nombregrupo,paso2.estacion,paso2.anio,temporada \n"
            r6 = "         FROM grupos, \n"
            r7 = "              (SELECT paso1.codsussan,proveedor,descri,preciolt1,grupo,paso1.id,paso1.talle,paso1.color,estacion,anio,temporada \n"
            r8 = "               FROM productos, \n"
            r9 = "                    (SELECT id,codsussan,talle,color \n"
            r10= "                     FROM producto_talle_color \n"
            r11= "                     WHERE id='"+self.textCtrl1.GetValue()+"') as paso1 \n"
            r12= "               WHERE productos.codsussan = paso1.codsussan) as paso2 \n"
            r13= "         WHERE paso2.grupo = grupos.idgrupo) as paso3 \n"
            r14= "   WHERE proveedor.idproveedor = paso3.codprov) as paso4 \n"
            r15= "WHERE paso4.color = colores.idcolor \n"
            sql = r1+r2+r3+r4+r5+r6+r7+r8+r9+r10+r11+r12+r13+r14+r15
            print "Buscando por P.T.C."
            return consultasBD.ordenCruda(sql)
        #consulta por CODSUSSAN
        if str(self.textCtrl2.GetValue()) != "":
            r1 = "SELECT ptc,codsussan,talle,color,colores.nombre,descripcion,codprov,proveedor,grupo,nombregrupo,precioventa,estacion,anio,temporada \n"
            r2 = "FROM colores, \n"
            r3 = "  (SELECT ptc,codsussan,talle,color,descripcion,codprov,nombre as proveedor,preciolt1 as precioventa,grupo,nombregrupo,estacion,anio,temporada \n"
            r4 = "   FROM proveedor, \n"
            r5 = "        (SELECT id as ptc, codsussan, talle, color, descri as descripcion, proveedor as codprov, preciolt1, paso2.grupo, nombregrupo,paso2.estacion,paso2.anio,temporada \n"
            r6 = "         FROM grupos, \n"
            r7 = "              (SELECT paso1.codsussan,proveedor,descri,preciolt1,grupo,paso1.id,paso1.talle,paso1.color,estacion,anio,temporada \n"
            r8 = "               FROM productos, \n"
            r9 = "                    (SELECT id,codsussan,talle,color \n"
            r10= "                     FROM producto_talle_color \n"
            r11= "                     WHERE codsussan='"+self.textCtrl2.GetValue()+"') as paso1 \n"
            r12= "               WHERE productos.codsussan = paso1.codsussan) as paso2 \n"
            r13= "         WHERE paso2.grupo = grupos.idgrupo) as paso3 \n"
            r14= "   WHERE proveedor.idproveedor = paso3.codprov) as paso4 \n"
            r15= "WHERE paso4.color = colores.idcolor \n"
            sql = r1+r2+r3+r4+r5+r6+r7+r8+r9+r10+r11+r12+r13+r14+r15
            print "Buscando por Codigo Sussan"
            return consultasBD.ordenCruda(sql)
        #consulta por CODIGO PROVEEDOR
        if str(self.textCtrl5.GetValue()) != "":
            r1 = "SELECT ptc,codsussan,talle,color,colores.nombre,descripcion,codprov,proveedor,grupo,nombregrupo,precioventa,temporada \n"
            r2 = "FROM colores, \n"
            r3 = "  (SELECT ptc,codsussan,talle,color,descripcion,codprov,nombre as proveedor,preciolt1 as precioventa,grupo,nombregrupo,temporada \n"
            r4 = "   FROM proveedor, \n"
            r5 = "        (SELECT id as ptc, codsussan, talle, color, descri as descripcion, proveedor as codprov, preciolt1, paso2.grupo, nombregrupo,temporada \n"
            r6 = "         FROM grupos, \n"
            r7 = "              (SELECT paso1.codsussan,proveedor,descri,preciolt1,grupo,paso1.id,paso1.talle,paso1.color,temporada \n"
            r8 = "               FROM productos, \n"
            r9 = "                    (SELECT id,producto_talle_color.codsussan,talle,color \n"
            r10= "                     FROM producto_talle_color, \n"
            r11= "                          (SELECT codsussan FROM productos \n"
            r12= "                           WHERE proveedor='"+self.textCtrl5.GetValue()+"') as inicial \n"
            r13= "                     WHERE producto_talle_color.codsussan=inicial.codsussan) as paso1 \n"
            r14= "               WHERE productos.codsussan = paso1.codsussan) as paso2 \n"
            r15= "         WHERE paso2.grupo = grupos.idgrupo) as paso3 \n"
            r16= "   WHERE proveedor.idproveedor = paso3.codprov) as paso4 \n"
            r17= "WHERE paso4.color = colores.idcolor \n"
            sql = r1+r2+r3+r4+r5+r6+r7+r8+r9+r10+r11+r12+r13+r14+r15+r16+r17
            print "Buscando por Codigo Sussan"
            return consultasBD.ordenCruda(sql)
        #otras consultas
        print "otras consultas"

    def llenarGrilla(self,resultado):
        renglon = 0
        for item in resultado:
            self.grid1.SetCellValue(renglon,0,str(item[0])) #ptc
            self.grid1.SetCellValue(renglon,1,str(item[1])) #codsussan
            self.grid1.SetCellValue(renglon,2,str(item[2])) #talle
            self.grid1.SetCellValue(renglon,3,str(item[3])+" / "+str(item[4])) #color
            self.grid1.SetCellValue(renglon,4,str(item[8])+" / "+str(item[9])) #grupo
            self.grid1.SetCellValue(renglon,5,str(item[10])) #talle
            self.grid1.SetCellAlignment(renglon, 5, wx.ALIGN_RIGHT, wx.ALIGN_CENTRE)
            self.grid1.SetCellValue(renglon,6,"0") #stockcentral
            self.grid1.SetCellAlignment(renglon, 6, wx.ALIGN_RIGHT, wx.ALIGN_CENTRE)
            self.grid1.SetCellValue(renglon,7,"0") #stockparana
            self.grid1.SetCellAlignment(renglon, 7, wx.ALIGN_RIGHT, wx.ALIGN_CENTRE)
            self.grid1.SetCellValue(renglon,8,"0") #stocksaska
            self.grid1.SetCellAlignment(renglon, 8, wx.ALIGN_RIGHT, wx.ALIGN_CENTRE)
            self.grid1.SetCellValue(renglon,9,"0") #stockpeatonal
            self.grid1.SetCellAlignment(renglon, 9, wx.ALIGN_RIGHT, wx.ALIGN_CENTRE)
            
            self.grid1.AppendRows(1)
            renglon = renglon + 1

        for col in xrange(self.grid1.GetNumberCols()):
            self.grid1.AutoSizeColumn(col,True)

        self.grid1.Refresh()

    def cargarStock(self):
        for renglon in xrange(self.grid1.GetNumberRows()):
            ptc = self.grid1.GetCellValue(renglon,0)
            if ptc == "":
                continue
            consultaSQL = "SELECT * FROM stock WHERE ptc='"+ptc+"'"
            resultado = consultasBD.ordenCrudaDict(consultaSQL)
            for item in resultado:
                if item["sucursal"] == '1':
                    self.grid1.SetCellValue(renglon,6,str(item["stock"]))
                    continue
                if item["sucursal"] == '2':
                    self.grid1.SetCellValue(renglon,7,str(item["stock"]))
                    continue
                if item["sucursal"] == '3':
                    self.grid1.SetCellValue(renglon,8,str(item["stock"]))
                    continue
                if item["sucursal"] == '4':
                    self.grid1.SetCellValue(renglon,9,str(item["stock"]))
                    continue

        self.grid1.Refresh()

    def OnBotonLimpiar(self, event):
        self.textCtrl1.SetValue("")
        self.textCtrl2.SetValue("")
        self.textCtrl3.SetValue("")
        self.textCtrl4.SetValue("")
        self.textCtrl5.SetValue("")
        self.textCtrl6.SetValue("")
        self.textCtrl7.SetValue("")
        self.textCtrl8.SetValue("")
        self.textCtrl9.SetValue("")
        self.grid1.ClearGrid()
        totalfilas = self.grid1.GetNumberRows()
        for renglon in xrange(totalfilas,0,-1):
            self.grid1.DeleteRows(renglon-1)
        self.grid1.AppendRows(1)
        self.grid1.Refresh()
        self.textCtrl1.SetFocus()

    def OnBotonAceptar(self, event):
        resultado = self.consultaSQL()
        if resultado == None or resultado == ():
            texto = "No se encontraron resultados\nVerifique los codigos ingresados"
            utiles.mensaje(None,texto)
            self.OnBotonLimpiar(None)
            return
        aux = resultado[0]
        if self.textCtrl1.GetValue() != "":
            self.textCtrl1.SetValue(aux[0])
        self.textCtrl2.SetValue(aux[1])
        self.textCtrl3.SetValue(aux[5])
        self.textCtrl4.SetValue(aux[7])
        self.textCtrl5.SetValue(aux[6])
        self.textCtrl6.SetValue(str(aux[11]))
        self.textCtrl7.SetValue(str(aux[12]))
        self.textCtrl8.SetValue(str(aux[8])+" / "+str(aux[9]))
        self.textCtrl9.SetValue(aux[13])

        self.llenarGrilla(resultado)
        self.cargarStock()
        
        self.button3.SetFocus()

    def OnBotonImprimir(self, event):
        if self.textCtrl3.GetLabel()=="":
            self.textCtrl1.SetFocus()
        print "Imprimiendo"
        f=open("c:\\matrisamor.doc\\reporte-BuscarArticulo.html","w")
        numeroPagina = 1
        nrosuc,nombresuc = utiles.datosSucursal()
        
        totalItemPorPagina = 38
        totalPaginas = int(self.grid1.GetNumberRows()-1) / totalItemPorPagina 
        totalPaginas+= 1

        def encabezadoPagina(texto):
            fecha = utiles.getfechaTime()
            proveedor = self.textCtrl4.GetLabel()[:20]+" / "+self.textCtrl5.GetLabel()
            descripcion = self.textCtrl3.GetLabel()

            a = '<table width="100%" cellspacing="0" border="0">\n'
            a+= '<tr>\n'
            a+= '<td valign="top" align="left" width="40%">'
            a+= 'SUSSAN BOUTIQUE Articulos<br>'+nombresuc+'</td>\n'
            a+= '<td valign="top" align="left" width="20%">'
            a+= '<br>'
            a+= '</font></td>\n'
            a+= '<td valign="top" align="right" width="40%">'+fecha
            a+= '<br>P&aacute;gina '+str(numeroPagina)+' / '+str(totalPaginas)+'</td>\n'
            a+= '</tr>\n'
            a+= '</table></font>\n'
            a+= '<br>'
            a+= 'Descripcion '+descripcion+'<br>'
            a+= 'Proveedor: '+proveedor+'<br>'
            a+= '<hr>\n'
            texto+= a
            return texto
        
        def encabezadoTabla(texto):
            a = '<table width="100%" cellspacing="1" border="0"> \n'
            a+= '<tr>\n'
            a+= '<td valign="top" align="right"><font size="0.1">orden</font></td>\n'
            a+= '<td valign="top" align="center">P.T.C.</td>\n'
            a+= '<td valign="top" align="center">Codigo<br>Sussan</td>\n'
            a+= '<td valign="top" align="left">Talle</td>\n'
            a+= '<td valign="top" align="left">Color</td>\n'
            a+= '<td valign="top" align="left"><font size="0.1">Grupo</font></td>\n'
            a+= '<td valign="top" align="right"><font size="0.1">Precio<br>Venta</font></td>\n'
            a+= '<td valign="top" align="right">Stock<br>Central</td>\n'
            a+= '<td valign="top" align="right">Stock<br>Parana</td>\n'
            a+= '<td valign="top" align="right">Stock<br>Saska</td>\n'
            a+= '<td valign="top" align="right">Stock<br>Peatonal</td> \n'
            a+= '</tr>\n'
            a+= '<tr>\n'
            a+= '<td colspan="11"><hr></td>\n'
            a+= '</tr>\n'
            texto+= a
            return texto
        
        cadena = '<?xml version="1.0" encoding="utf-8" ?> \n'
        cadena+= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> \n'
        cadena+= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> \n'
        cadena+= '<head> \n'
        cadena+= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> \n'
        cadena+= '<meta name="generator" content="Docutils 0.4.1: http://docutils.sourceforge.net/" /> \n'
        cadena+= '<title>Sussan Boutique</title> \n'
        cadena+= '</head> \n'
        cadena+= '<body> \n'

        cadena = encabezadoPagina(cadena)
        cadena = encabezadoTabla(cadena)
        f.write(cadena)
        
        renglon = 0
        for i in xrange(self.grid1.GetNumberRows()-1):
        #PTC,CodSussan,Descripcion,Talle,Color,Stock\nCentral,Stock\nParana,Stock\nSaska,Stock\nPeatonal
            ptc = self.grid1.GetCellValue(i,0)
            codsussan = self.grid1.GetCellValue(i,1)
            talle = self.grid1.GetCellValue(i,2)
            color = self.grid1.GetCellValue(i,3)
            grupo = self.grid1.GetCellValue(i,4)
            precioventa = "#"+self.grid1.GetCellValue(i,5)
            stockcentral = self.grid1.GetCellValue(i,6)
            stockparana = self.grid1.GetCellValue(i,7)
            stocksaska = self.grid1.GetCellValue(i,8)
            stockpeatonal = self.grid1.GetCellValue(i,9)

            orden = str(i+1)

            cadena = '<tr>\n'
            cadena+= '<td valign="center" align="right"><font size="0.1">'+orden+'</font></td> \n'
            cadena+= '<td valign="center" align="center">'+ptc+'</td> \n'
            cadena+= '<td valign="center" align="center">'+codsussan+'</td> \n'
            cadena+= '<td valign="center" align="left"><font size="0.1">'+talle+'</font></td> \n'
            cadena+= '<td valign="center" align="left"><font size="0.1">'+color+'</font></td> \n'
            cadena+= '<td valign="center" align="left"><font size="0.1">'+grupo+'</font></td> \n'
            cadena+= '<td valign="center" align="right"><font size="0.1">'+precioventa+'</font></td> \n'
            cadena+= '<td valign="center" align="right">'+stockcentral+'</td> \n'
            cadena+= '<td valign="center" align="right">'+stockparana+'</td> \n'
            cadena+= '<td valign="center" align="right">'+stocksaska+'</td> \n'
            cadena+= '<td valign="center" align="right">'+stockpeatonal+'</td> \n'
            cadena+= '</tr>\n'
            try:
                f.write(cadena)
            except:
                print cadena
            
            renglon+= 1
            
            if renglon >= totalItemPorPagina :
                renglon = 0
                f.write("</table><!-- salto de pagina -->\n")
                f.write("<p STYLE='page-break-after: always;'></p>\n")
                numeroPagina+= 1
                cadena = encabezadoPagina("")
                cadena = encabezadoTabla(cadena)
                f.write(cadena)
            
        cadena = '</table>\n'
        cadena+= '<br>Total &iacute;tems: '+str(self.grid1.GetNumberRows()-1)+'\n'
        cadena+= '<br>Total p&aacute;ginas: '+str(numeroPagina)+'\n'
        cadena+= '</body>\n</html>\n'
        f.write(cadena)
        f.close()

        self.button2.SetFocus()

        import os
        os.system("taskkill /IM firefox.exe /F")
        os.system("c:\\explorer.lnk c:\\matrisamor.doc\\reporte-BuscarArticulo.html")
        
